import Vue from 'vue'
import App from './App.vue'
// 引入路由
import router from '@/router'
import '@/mock/mockServe'
// 注册全局组件
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
import {Button, MessageBox} from 'element-ui'

import './assets/iconfont.css'
import "swiper/css/swiper.css";
import store from '@/store'

import * as API from '@/api'

import VueLazyload from 'vue-lazyload'
import icons from '@/assets/images/icons.png'
Vue.use(VueLazyload, {
  // 懒加载默认的图片
  loading: icons
})

// 引入表单验证插件
import "@/plugins/validate";

Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(Pagination.name, Pagination)

Vue.component(Button.name, Button)

Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

new Vue({
    render: h => h(App),
    // 全局事件总线$bus配置
    beforeCreate() {
        Vue.prototype.$bus = this;
        Vue.prototype.$API = API;
    },
    router,
    store
}).$mount('#app')
